import request from "@/utils/request";
//查询全部部门数据
//export：将数据抛出（谁调用就抛出给谁）

//新增
export const addApiBook = (books) => request.post('/books/addbook', books);



//查询图书 // 使用axios的params参数，让axios自动处理参数构建和编码
export const queryApiBook = (ISBN,category,begin,end,page,pageSize) =>{
  // 构建查询参数对象
  const params = {
    ISBN: ISBN || undefined,
    category: category || undefined,
    begin: begin || undefined,
    end: end || undefined,
    page: page,
    pageSize: pageSize
  };

// 使用axios的params参数，让axios自动处理参数构建和编码
  return request.get('/books/page', { params });
}

//删除图书
export const deleteApiBook = (ids) => request.delete(`/books/delete/${ids}`)

//根据id查询图书数据
export const getByidApi = (id) => request.get(`/books/${id}`)

//修改图书
export const updateBookApi = (books) => request.put('/books/updateBook',books)
  
